import ToolAction from "@/tool/http/ToolAction.js";

export default {
	namespaced: true,
	state: {
		areas: []
	},
	mutations: {
		updateArea: (state, areas) => {
			state.areas = areas;
		}
	},
	actions: {
		async listArea(context) {
			if (context.state.areas && context.state.areas.length > 0) {
				return context.state.areas;
			}
			let res = await ToolAction.run("action-area-list", "63705362eaed4cafa7fa798403b18272");
			context.commit("updateArea", [res]);
			return [res];
		}
	}
}
